home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWShpLst.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.1 KB  |  159 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWShpLst.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSHPLST_H
  11. #define FWSHPLST_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWENVDEF_H
  20. #include "FWEnvDef.h"
  21. #endif
  22.  
  23. #ifndef FWEXCLIB_H
  24. #include "FWExcLib.h"
  25. #endif
  26.  
  27. #ifndef FWCOUPTR_H
  28. #include "FWCouPtr.h"
  29. #endif
  30.  
  31. #ifndef FWTCOLL_H
  32. #include "FWTColl.h"
  33. #endif
  34.  
  35. // ----- OpenDoc Includes -----
  36.  
  37. #ifndef FWODTYPS_H
  38. #include "FWODTyps.h"
  39. #endif
  40.  
  41. //========================================================================================
  42. //    Forward Declarations
  43. //========================================================================================
  44.  
  45. class FW_CGraphicContext;
  46. class FW_CPoint;
  47. class FW_CRect;
  48. class FW_CReadableStream;
  49. class FW_CWritableStream;
  50.  
  51. //========================================================================================
  52. //    class FW_CShapeListRep
  53. //========================================================================================
  54.  
  55. class FW_CShapeListRep : public FW_MCountedPtrRep
  56. {
  57.  
  58.     friend class FW_CShapeListIterator;
  59.  
  60. //----------------------------------------------------------------------------------------
  61. //    Constructors/Destructors
  62. //
  63. public:
  64.  
  65.     FW_DECLARE_AUTO(FW_CShapeListRep)
  66.  
  67.     FW_CShapeListRep();
  68.     FW_CShapeListRep(const FW_CShapeListRep& other);
  69.     FW_CShapeListRep(FW_CReadableStream& stream);
  70.     ~FW_CShapeListRep();
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    New API
  74. //
  75.  
  76. public:
  77.     void            Write(FW_CWritableStream& stream) const;
  78.     FW_Boolean        IsEqual(const FW_CShapeListRep* other) const;
  79.  
  80.     // ----- Adding shapes
  81.     
  82.     void            AdoptAtTop(FW_CShape* shape);
  83.     void            AdoptAtBottom(FW_CShape* shape);
  84.     void            AdoptBelow(FW_CShape* shapeToAdd, FW_CShape* belowWhich);
  85.     void            AdoptAbove(FW_CShape* shapeToAdd, FW_CShape* aboveWhich);
  86.  
  87.     // ----- Removing shapes
  88.  
  89.     void            Remove(FW_CShape* shape);
  90.     void            RemoveAll();
  91.     FW_CShape*        RemoveTop();
  92.     FW_CShape*        RemoveBottom();
  93.  
  94.     // ----- List operations
  95.  
  96.     FW_Boolean        Contains(FW_CShape* shape) const;
  97.     unsigned long    GetCount() const;
  98.     void            Purge();
  99.     
  100.     // ----- Z-Order methods
  101.  
  102.     FW_Boolean        MoveUp(FW_CShape* shape);
  103.     FW_Boolean        MoveToTop(FW_CShape* shape);
  104.         
  105.     FW_Boolean        MoveDown(FW_CShape* shape);
  106.     FW_Boolean        MoveToBottom(FW_CShape* shape);
  107.  
  108.     // ----- Anchor Point 
  109.     FW_CPoint        GetAnchorPoint() const;
  110.  
  111. //----------------------------------------------------------------------------------------
  112. //    Implementation
  113. //
  114. private:
  115.     FW_TOrderedCollection<FW_CShape>*    fShapeList;
  116.     FW_Boolean                            fValidAnchorPoint;
  117.     FW_CPoint                            fAnchorPoint;
  118. };
  119.  
  120. //========================================================================================
  121. //    class FW_PShapeList
  122. //========================================================================================
  123.  
  124. class FW_PShapeList : public FW_TCountedPtr<FW_CShapeListRep>
  125. {
  126. public:
  127.     FW_PShapeList();
  128.     FW_PShapeList(FW_CReadableStream& stream);
  129.     virtual ~FW_PShapeList();
  130.     
  131.     FW_PShapeList(const FW_PShapeList& other);
  132.     FW_PShapeList& operator=(const FW_PShapeList& other);
  133.     
  134.     FW_PShapeList    Copy() const;
  135.  
  136.     friend FW_CWritableStream& operator << (FW_CWritableStream& stream, const FW_PShapeList& list);
  137.     friend FW_CReadableStream& operator >> (FW_CReadableStream& stream, FW_PShapeList& list);
  138. };
  139.  
  140. //========================================================================================
  141. //    class FW_CShapeListIterator
  142. //========================================================================================
  143.  
  144. class FW_CShapeListIterator : public FW_TOrderedCollectionIterator<FW_CShape>
  145. {
  146. public:
  147.     FW_DECLARE_AUTO(FW_CShapeListIterator)
  148.  
  149.     FW_CShapeListIterator(const FW_PShapeList& shapeList) :
  150.         FW_TOrderedCollectionIterator<FW_CShape>(shapeList->fShapeList) {}
  151.     FW_CShapeListIterator(const FW_CShapeListRep& shapeListRep) :
  152.         FW_TOrderedCollectionIterator<FW_CShape>(shapeListRep.fShapeList) {}
  153.     ~FW_CShapeListIterator() {}
  154. };
  155.  
  156.  
  157.  
  158. #endif
  159.